# -*- coding: utf-8 -*-
"""
Created on 04/05/2023
@author: 曾导SJTU
"""

# 这里是一些小的公式

import numpy as np
from precision_data import fp

def cal_area_vol(dx, dy, dz):
    
    area_x = dy*dz
    area_y = dx*dz
    area_z = dx*dy
    vol    = dx*area_x
    
    return area_x, area_y, area_z, vol


def a_nb(area, idx, ul, ur, gl, gr, rho, sign_f):

    f = rho*fp(0.5)*(ul+ur)  # 0 for pure diffusion
    d = fp(2.0)*gl*gr/(gl+gr+fp(1.e-12))*idx    # k / \Delta x
    a = area * ( d + max(fp(0.0),sign_f*f) )    # k * \Delta y / \Delta x

    return a